package com.ehome.poct.terminal.mapping;

import com.ehome.poct.terminal.api.dto.TestDeviceVersionDTO;
import com.ehome.poct.terminal.api.qry.CurrentDriverVersionQry;
import com.ehome.poct.terminal.api.qry.CurrentSoftwareVersionQry;
import com.ehome.poct.terminal.api.qry.NewSoftwareVersionQry;
import com.ehome.poct.terminal.api.qry.NewVersionQry;
import com.ehome.poct.terminal.api.vo.DriverUpgradeVO;
import com.ehome.poct.terminal.api.vo.FirmwareUpgradeVO;
import com.ehome.poct.terminal.api.vo.SoftwareUpgradeVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

@Mapper(componentModel = "spring")
public interface UpgradeMapping {


    @Mapping(target = "forceUpdate", expression = "java(dto.getUpgradeType()==0)")
    DriverUpgradeVO toDriverVO(TestDeviceVersionDTO dto);

    @Mapping(target = "forceUpdate", expression = "java(dto.getUpgradeType()==0)")
    FirmwareUpgradeVO toFirmwareVO(TestDeviceVersionDTO dto);

    @Mapping(target = "forceUpdate", expression = "java(dto.getUpgradeType()==0)")
    SoftwareUpgradeVO toSoftwareVO(TestDeviceVersionDTO dto);

    List<SoftwareUpgradeVO> toSoftwareVOs(List<TestDeviceVersionDTO> dto);

    CurrentDriverVersionQry to(NewVersionQry dto);

    CurrentSoftwareVersionQry to(NewSoftwareVersionQry dto);
}
